﻿using Miao.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Miao.UI
{
    [SourcesPath("Assets/Plugins/miao-framework/UIPrefab/Select.prefab")]
    public class Select : UIMotionPanel
    {
        public TextMeshProUGUI title;
        public TextMeshProUGUI content;
        public TextMeshProUGUI yesText;
        public TextMeshProUGUI noText;

        public Button yes;
        public Button no;

        public Func<bool> Condition;

        public override async Task OnCreate()
        {
            if (Condition!=null && Condition.Invoke())
            {
                yes.interactable = false;
            }
            yes.onClick.AddListener(Close);
            no.onClick.AddListener(Close);
            await base.OnCreate();
        }
    }
}
